import axios from 'axios';

const API_URL = 'http://localhost:8080/api/roles';
import request from '@/utils/request'

export function getRoles() {
  return request({
    url: '/api/roles',
    method: 'get'
  })
}

export default {
  getAllRoles() {
    return axios.get(API_URL);
  },
  createRole(roleData) {
    return axios.post(API_URL, roleData);
  },
  updateRole(roleId, roleData) {
    return axios.put(`${API_URL}/${roleId}`, roleData);
  },
  deleteRole(roleId) {
    return axios.delete(`${API_URL}/${roleId}`);
  }
};
